<template>
	<view>
		<mescroll-uni :fixed="false" :down="downOption" :up="upOption" @up="upCallback" @init="mescrollInit">
			<view class="container">
				<view v-for="(item,index) in list" :key="index">
					待审核：{{index}}
					<text @click="review(item)">审核</text>
				</view>
			</view>
		</mescroll-uni>

		<view class="showReview-warp" v-if="showReview">
			<view class="showReview-rect" @tap.stop>
				<text class="showReview-titles" style="font-size: 14px;">设置达标</text>
				<view class="showReview-set-task">
					<text>设置达标</text>
					<view class="right">
						<view class="right-item" @click="changeRadio(0)">
							<image src="https://mpres.trendbeat.cn/mp_static/icons/check.png" mode="aspectFill"
								v-if="radio1">
							</image>
							<image src="https://mpres.trendbeat.cn/mp_static/icons/checked.png" mode="aspectFill"
								v-if="!radio1">
							</image>
							<text>已达标</text>
						</view>
						<view class="right-item" @click="changeRadio(1)">
							<image src="https://mpres.trendbeat.cn/mp_static/icons/check.png" mode="aspectFill"
								v-if="radio2">
							</image>
							<image src="https://mpres.trendbeat.cn/mp_static/icons/checked.png" mode="aspectFill"
								v-if="!radio2">
							</image>
							<text>未达标</text>
						</view>
					</view>
				</view>
				<u--textarea type="text" v-if="!radio2" style="font-size: 12px;" placeholder="请填写原因" v-model="err_msg"
					placeholder-class="my-input-placeholder">
				</u--textarea>
				<view class="footer">
					<text class="button" @click="setTaskType()">确定</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Mescroll from '../info-share/mescroll-uni/mescroll-uni.vue'
	import {
		parkInfoList
	} from '@/api/parkInfo.js'
	export default {
		components: {
			'mescroll-uni': Mescroll
		},
		data() {
			return {
				showReview: false,
				list: [],
				mescroll: null, //mescroll实例对象
				downOption: {
					use: false, // 是否启用下拉刷新; 默认true
				},
				upOption: {
					use: true, // 是否启用上拉加载; 默认true
					auto: true, // 是否在初始化完毕之后自动执行上拉加载的回调; 默认true
					page: {
						num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
						size: 20 // 每页数据的数量
					},
					noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
					empty: {
						tip: '暂无数据', // 提示
						icon: ''
					}
				},
			}
		},
		methods: {
			mescrollInit(mescroll) {
				this.mescroll = mescroll;
			},


			async upCallback(page) {
				console.log("this.currentIndex: ", this.currentIndex);
				// setTimeout(() => {
				// 	this.$nextTick(() => {
				// 		this.mescroll.endSuccess(1)
				// 	})
				// }, 500)
				// return
				const location = wx.getStorageSync('location')
				console.log("location: ", location);
				const params = {
					page: page.num,
					currentZb: `${location.longitude},${location.latitude}`,
					limit: page.size,
					status: '审核中',
				};

				const response = await parkInfoList(params)
				console.log("response: ", response);

				if (response) {
					this.list = response.data.list
					setTimeout(() => {
						this.$nextTick(() => {
							this.mescroll.endSuccess(response.data.list.length)
						})
					}, 500)
				}
			},

			review(item) {
				console.log("item: ", item);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.review-page {


		.showReview-warp {
			display: flex;
			align-items: center;
			justify-content: center;
			height: 100%;

			.showReview-rect {
				width: 290px;
				background: #FFFFFF;
				border-radius: 10px;
				padding: 20px 15px;

				.showReview-titles {
					display: block;
					text-align: center;
					font-size: 15px;
					font-weight: 600;
					color: #404040;
				}

				.showReview-set-task {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 15px 0;
					border-bottom: 1px solid #f7f8f5;

					>text {}

					>.right {
						display: flex;

						>.right-item {
							margin-left: 10px;
							display: flex;
							align-items: center;

							>image {
								margin-right: 5px;
								width: 18px !important;
								height: 18px !important;
							}
						}
					}
				}

				.footer {
					display: flex;
					align-items: center;
					justify-content: center;
					margin-top: 15px;

					>.button {
						line-height: 40px;
						text-align: center;
						width: 110px;
						height: 40px;
						background: #A7DC39;
						border-radius: 20px;
						font-size: 15px;
						font-weight: 600;
						color: #FFFFFF;
						cursor: pointer;
					}
				}
			}
		}
	}
</style>
